#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <syslog.h>
#include <errno.h>

#include "icar.h"
#include "icar_log.h"
#include "icar_utils.h"

char
chtoi(char c)
{
	return ((c >= '0' && c <= '9') ? c - '0' : (c >= 'a' && c <= 'f') ? (c - 'a' + 10) : (c - 'A' + 10));
}

void * icar_malloc(size_t size) {
	void *retval = NULL;
	retval = malloc(size);

	if (!retval) {
		icar_daemon(LOG_CRIT, "Failed to malloc %d bytes of memory: %s. Bailing out", size, strerror(errno));
		exit(1);
	}

	return retval;
}

